package com.nulldev.util.logging;

public class LoggerFactory {

	public static Logger getGenericLogger(Class<?> cls) {
		return Logger.instance;
	}

	public static Logger getLogger(Class<?> cls) {
		return new Logger(cls.getName());
	}
	
	public static Logger getLogger(Class<?> cls, final boolean newLook, final boolean displayClassName) {
		final Logger l = new Logger(cls.getName());
		l.USE_NEW_LOOK = newLook;
		l.NEW_LOOK_DISPLAY_CLASS_NAME = displayClassName;
		return l;
	}
	
	public static Logger getLog(Class<?> cls) {
		return new Logger(cls.getName());
	}

	public static Logger getLogger() {
		return new Logger(Thread.currentThread().getStackTrace()[2].getClassName());
	}
	
	public static Logger getLogger(final boolean newLook, final boolean displayClassName) {
		final Logger l = new Logger(Thread.currentThread().getStackTrace()[2].getClassName());
		l.USE_NEW_LOOK = newLook;
		l.NEW_LOOK_DISPLAY_CLASS_NAME = displayClassName;
		return l;
	}

	public static Logger getGenericDefault() {
		return Logger.instance;
	}

	public static Logger getLoggerName(final String className) {
		return new Logger(className);
	}

	public static Logger getLogger(final boolean noInfo) {
		final Logger out = getLoggerName(Thread.currentThread().getStackTrace()[2].getClassName());
		out.infoEnabled = !noInfo;
		return out;
	}
	
	public static Logger getLoggerD(final boolean debug) {
		final Logger out = getLoggerName(Thread.currentThread().getStackTrace()[2].getClassName());
		out.debugEnabled = debug;
		return out;
	}
	
	public static Logger getLoggerD(final boolean debug, final boolean newLook, final boolean displayClassName) {
		final Logger out = getLoggerName(Thread.currentThread().getStackTrace()[2].getClassName());
		out.debugEnabled = debug;
		out.USE_NEW_LOOK = newLook;
		out.NEW_LOOK_DISPLAY_CLASS_NAME = displayClassName;
		return out;
	}
	
	public static Logger getLoggerD(final boolean debug, final String name) {
		final Logger out = getLoggerName(name);
		out.debugEnabled = debug;
		return out;
	}
	
	public static Logger getLoggerD(final boolean debug, final String name, final boolean newLook, final boolean displayClassName) {
		final Logger out = getLoggerName(name);
		out.debugEnabled = debug;
		out.USE_NEW_LOOK = newLook;
		out.NEW_LOOK_DISPLAY_CLASS_NAME = displayClassName;
		return out;
	}

	public static Logger getLoggerName(final String string, final boolean newLook, final boolean displayClassName) {
		final Logger l = getLoggerName(string);
		l.NEW_LOOK_DISPLAY_CLASS_NAME = displayClassName;
		l.USE_NEW_LOOK = newLook;
		return l;
	}
}
